home *** CD-ROM | disk | FTP | other *** search
- u
- D O T B A S I C
- by Dave Moorman
-
-
- Creating applications with all the
- pazzazz and sparkle of mouse control
- just got easier -- with DOTBASIC. This
- is an extension to BASIC 2.0 that
- includes Mr.Mouse 2.1, Visual Design,
- Object Oriented Programming, and an
- Event Driven environment.
-
- These are concepts being used in
- PC programming languages such as
- Visual Basic.
-
- VISUAL. The programmer "draws" the
- screen (rather than writing a bunch of
- PRINT statements), using
-
- OBJECTS. A button has length, width,
- color, caption, and more. These are
- attributes to the Button Object. The
- programmer sets the attributes
- (visually) and doesn't have to worry
- about it again. OBJECTS also have one
- or more
-
- EVENT attributes. When the user
- clicks the button, the Event Handling
- subroutine (written by the programmer)
- is called, making the button do
- whatever the button does.
-
- DOTBASIC brings these to our
- modest world, making coding quick and
- painless. (OK -- we're going hyper-
- bolic here!) But imagine you have a
- utility in mind, one with several
- functions to be presented on the main
- screen. Here are the three steps to
- making a DOTBASIC program.
-
-
- DRAW IT VISUALLY
-
- LOAD and RUN "B.VDOT", the visual
- design program. Here you can type,
- draw blocks of text, edit the font,
- and paint colors. (Check the [Control]
- menu for the various options.) Design
- your screen the way you want it to
- appear.
-
- Now create Event Regions on your
- screen. Press <F1> (to make the menu
- bar appear) and click [Edit] > [Box].
- Move the square pointer to the upper
- left corner of the area you want the
- user to click for some particular
- function. For example, you probably
- have a "QUIT" button. Once the square
- in is place, click, then move the
- mouse down and right to open up the
- brackets to enclose the area you want
- for an Event Region. Click again.
-
- The Edit menu will reopen. Click
- [Add Region]. You are presented with a
- suggested Line Number. Press <Return>.
- For Right Click Enable, press <N>. For
- Hotkey, choose an appropriate letter
- key and input it.
-
- Now input the Unhighlighted color
- (probably the color you are using for
- the button), and press <Y> if you want
- it reversed. Do the likewise (with
- different colors or reversal) for the
- Highlighted color. Finally, Press
- <Y> if everything is the way you want
- it.
-
- Repeat the process for each Event
- Region you want. (Or later you can run
- VDOT, load your file, and add Regions
- at will.) When done, click [File] >
- [Save] and choose the [MED] file
- option.
-
- Type in the filename you want for
- this program. All working files will
- use the same name (with different
- prefixes and extensions). Click OK.
- Then click [File] > [Exit].
-
-
- BUILD A BOOT
-
- Step two is to create your program
- template. This is extremely easy.
- LOAD"B.DOT",dv and list line 60008.
- Change the line to include your
- program name (the one you used for
- your MED file -- without the .MED).
-
- 60008 N$="MYPROG"
-
- Then type
-
- GOTO60000<RETURN>
-
- to save your new boot file. Once it is
- saved, RUN it.
-
- The boot program will look for
- "MYPROG.DOT" -- and if it is not
- present, will create it for you. (You
- will see some text flash on the screen
- as this happens, but don't worry! It
- only happens once.) The title screen
- will appear.
-
- The DOT program will then attempt
- to attach the Event Regions you
- designed and assigned to the
- subroutine line number(s). Since they
- are not present yet, the line numbers
- and default commands are displayed on
- the screen, followed by an UNDEF'D
- LINE NUMBER ERROR.
-
- Move the cursor up to the
- displayed line numbers and press
- <RETURN> on each. Type
-
- GOTO60000<RETURN>
-
- Then RUN the program again.
-
- Your designed screen will appear,
- along with the mouse arrow. Use the
- mouse, cursor keys, or joystick to
- move the arrow. When it is over an
- Event Region, the color will change to
- the Highlighted color you selected.
- You can cycle through hightlighted
- Event Regions by pressing the <UP
- ARROW>.
-
- However, at this point, clicking
- on the Event Region will not do
- anything -- because you have not
- written the Event Handling
- Subroutines.
-
-
- WRITING THE CODE
-
- Press <BACK ARROW> to Escape the
- program, and LIST it. You will see:
-
- 90 SYS5120
- 100 .DO:.EE:.WA:.UN E%:.OF
- 101 END
-
- Welcome to DOTBASIC! You have up
- to 72 new commands at your disposal,
- several of which are right here.
-
- .DO starts the DO-loop.
-
- .EE Enables the Event Sensor.
-
- .WA Watches for a <BACK ARROW>
- keypress.
-
- .UN E% loops back to the .DO until E%
- is not 0.
-
- .OF turns off DOTBASIC and puts BASIC
- 2.0 back where it was when
- SYS5120 was called.
-
- Now you may be wondering how the
- program gets to the subroutines! It
- all happens behind the scenes, making
- this an Event Driven program
- environment.
-
- Let's do the EXIT routine,
- assuming the Event Region is attached
- to line 1000.
-
- 1000 REM" EXIT
- 1005 .RU, 218, 215
- 1010 E% = I%
- 1015 .ER
- 1020 RETURN
-
- Enter these lines and RUN the
- program. You should see an "Are You
- Sure?" box with an active Yes/No
- control.
-
-
- [IMPORTANT NOTE]
-
- If you have an ERROR, type
-
- .OF<RETURN>
-
- before trying to edit the code. This
- turns off everything so no problems
- will occur.
-
- Here are the meanings of the
- commands:
-
- .RU,u,h turns on the Are You Sure box
- and waits for the Yes or No to be
- clicked. Yes: I% = -1. No: I% = 0.
- U is the unhighlighted color. H is
- the Highlighted color. Add 208 to
- the color code of both the get the
- selected item unreversed.
-
- E% = I% puts the result of .RU
- (in I%) into E%. Remember, when E%
- is not 0, the .UN command in the
- main loop falls through.
-
- .ER Event screen Restore. When an
- Event occurs, the screen is stashed
- at page 232. This command brings it
- back.
-
- RETURN takes DOTBASIC back to the
- main loop. The Event Sensor is
- turned off during Event Handling,
- which is why .EE (Event Enable) is
- in the main loop.
-
-
- After you have writen the code for
- each attached Event, your program is
- finished! And remember, you have 77
- commands to do marvelous things with
- your program!
-
- When copying your program to a
- separate disk, copy the following
- files (MYPROG = Your Program Name):
-
- B.MYPROG
- MYPROG.MED
- MYPROG.DOT
- MOUSE2.1 7K 2400
- DF.ML
-
- You can use Lee Novak's LINKER and
- PACKER to put everything together in a
- single program file. For the BASIC
- file, choose MYPROG.DOT. Add Modules
- -- MYPROG.MED, MOUSE2.1 7K 2400, and
- DF.ML. You will have to change the
- load address of MYPROG.MED to 57344
- (Page 224). You will no longer need
- B.MYPROG to boot your program.
-
-
- SOME TECHNICAL INFORMATION
-
- DOTBASIC uses several variable
- names to pass information from the ML
- routines to BASIC:
-
- I% - The all-purpose Integer.
-
- E% - The Enable flag, used in the
- main loop, which will continue
- as long as E% = 0.
-
- FP - The Floating Point variable
- for returning values too large
- for I%.
-
- DOTBASIC uses only one area above
- page 64:
-
- Pages 224-242 is where your MED file
- is loaded and the main screen is
- stashed during Event Handling
- routines.
-
- And don't forget to type
-
- .OF<RETURN>
-
- after every BASIC ERROR.
-
-
- Be sure to read the DOTBASIC
- Command List for descriptions of each
- command. Next month, we will include
- Lee Novak's masterful Mr.Mouse2.1
- documentation -- updated with DOTBASIC
- commands.
-
- DMM
-
-
-